package com.lanou.web.controller;

import com.lanou.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping("/test")
    public void test(HttpServletResponse response) throws IOException {

        demoService.serve();

        response.setContentType("text/html;charset=utf-8");
        //response.setCharacterEncoding("utf-8");
        response.getWriter().print("成功调用服务！");
    }
}